<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<script src="${path}/js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
	function congz() {
		$(".input_form").val('');
	}
	$("#select1").on('change', function() {
		var vv = $("#select1 option:selected").val();
		$("#state").val(vv);

	});
	function find() {
		var username = $("#tname").val();
		alert(username);
	}
/* 	if ("${type}"!=null||"${type}"!="") {
		alert(111);
	} */
</script>
<!-- Main content -->
<div id="myAlert" class="alert alert-success" style="display: none;">
	<a href="#" class="close" data-dismiss="alert">&times;</a> <strong>成功！</strong>结果是成功的。
</div>
<section class="content">
	<div id="td_text">
		<p id="td_p">这里显示数据哦！
		<p>
	</div>
	<!--表单 -->
	<div class="row">
		<div class="col-xs-12">
			<div class="panel">
				<header class="panel-heading"> 学生信息表单 </header>
				<!-- <div class="box-header"> -->
				<!-- <h3 class="box-title">Responsive Hover Table</h3> -->

				<!-- </div> -->
				<div class="panel-body table-responsive">
					<div class="box-tools m-b-15">
						<div class="input-group"
							style="margin-top: 10px; margin-bottom: 10px;">
							<button onclick="add('add1')" type="button"
								class="btn btn-info btn-sm" data-toggle="modal"
								data-target="#myModal">
								<span class="glyphicon glyphicon-plus"></span> 添加
							</button>
							<button id="cModal" data-toggle="modal" data-target="#myModal"
								style="display: none;"></button>
							<label style="width: 10px"></label>
							<button onclick="edit('edit1')" type="button"
								class="btn btn-info btn-sm"
								style="padding-left: 10px; background: #FAD733;"
								data-toggle="modal" data-target="#myModal2">
								<span class="glyphicon glyphicon-pencil"></span> 编辑
							</button>
							<label style="width: 10px"></label>
							<button type="button" class="btn btn-default btn-sm"
								style="color: rgb(212, 106, 64);">
								<span class="glyphicon glyphicon-remove"></span> 删除
							</button>
							<label style="width: 10px"></label>
							<button id="shux" onclick="tihuan('right_side1')" type="button"
								class="btn btn-default btn-sm pull-right"
								style="padding-left: 10px; color: blue;">
								<span class="glyphicon glyphicon-repeat"></span> 刷新
							</button>

						</div>
						<form accept-charset="utf-8">
							<div class="input-group" style="margin-top: 20px">
								<div class="form-group" style="width: 1200px">
									<label style="float: left; padding-top: 5px">用户名:</label>
									<div class="col-sm-2">
										<input id="tname" type="text" name="tname" value=""
											class="form-control input_form" placeholder="请输入用户名">
									</div>
									<label style="float: left; padding-top: 5px">学号:</label>
									<div class="col-sm-2">
										<input id="tid" type="text" name="tid"
											class="form-control input_form" placeholder="请输入学号"
											onkeyup="value=value.replace(/[^\d]/g,'')">
									</div>
									<label style="float: left; padding-top: 5px">所在班级:</label>
									<div class="col-sm-2">
										<input id="className" type="text" name="className" value=""
											class="form-control input_form" placeholder="请输入班级名">
									</div>
									<input id="state" class="input_form" name="state" type="hidden"
										value="" readonly="readonly"> <label
										style="float: left; padding-top: 5px; margin-right: 10px">状态:</label>
									<select id="select1" class="form-control col-sm-2 input_form"
										style="width: 10%;">
										<option value=""></option>
										<option value="1">启用</option>
										<option value="0">禁用</option>
									</select>
									<button type="button" onclick="tihuan('right_side1')"
										class="btn btn-info btn-sm" style="margin-left: 10px">
										<span class="glyphicon glyphicon-search"></span> 查询
									</button>
									<button type="button" onclick="congz()"
										class="btn btn-info btn-sm" style="margin-left: 10px">
										<span class="glyphicon glyphicon-refresh"></span> 重置
									</button>
								</div>
							</div>
						</form>

					</div>
					<form >
						<table class="table table-hover">
							<tr>
								<th><input type="checkbox" id="selectAll" class="select"></th>
								<th>序号</th>
								<th>头像</th>
								<th>用户名</th>
								<th>学号</th>
								<th>密码</th>
								<th>性别</th>
								<th>生日</th>
								<th>电话</th>
								<th>地址</th>
								<th>所在学校</th>
								<th>班级</th>
								<th>所在宿舍</th>
								<th>QQ</th>
								<th>启用状态</th>
								<th>报到时间</th>
								<th style="text-align: center;">操作</th>
							</tr>
							<c:forEach items="${findPageStudent.list}" var="student"
								varStatus="userStatus">
								<tr>
									<td><input type="checkbox" name="select" class="select"
										width="30px"></td>
									<td class="div_hide">${userStatus.count}</td>
									<td class="div_hide"><c:if test="${empty student.images}"></c:if>
										<c:if test="${not empty student.images}">
											<img src="${path}${student.images}" alt="这里显示头像"
												style="width: 40px; height: 40px; border-radius: 50%;">
										</c:if></td>
									<td>${student.username}</td>
									<td>${student.studentid}</td>
									<td>${student.password}</td>
									<td class="div_hide"><c:if test="${student.sex==1}">
											<p>男</p>
										</c:if> <c:if test="${student.sex == 2 }">
											<p>女</p>
										</c:if></td>
									<td><fmt:formatDate value="${student.birthdate}"
											pattern="yyyy-MM-dd" /></td>
									<td>${student.phone}</td>
									<td>${student.address}</td>
									<td>${student.college}</td>
									<td>${student.inclass}</td>
									<td>6栋201 ${student.state}</td>
									<td>${student.qq}</td>
									<td class="div_hide"><c:if test="${student.state==0}">
											<span class="label label-danger">禁用</span>
										</c:if> <c:if test="${student.state==1}">
											<span class="label label-success">启用</span>
										</c:if></td>
									<td><c:if test="${empty student.reporttotime}">
											<span class="label label-warning div_hide">未报到</span>
										</c:if> <c:if test="${not empty student.reporttotime}">
											<fmt:formatDate value="${student.reporttotime}"
												pattern="yyyy-MM-dd HH:mm:ss" />
										</c:if></td>
									<td class="div_hide"><div class="pull-right hidden-phone">
											<button class="btn btn-default btn-xs">
												<i class="glyphicon glyphicon-refresh"></i>
											</button>
											<button class="btn btn-default btn-xs">
												<i class="fa fa-pencil"></i>
											</button>
											<button class="btn btn-default btn-xs">
												<i class="fa fa-times"></i>
											</button>
										</div></td>
								</tr>
							</c:forEach>
							<tr>
								<td colspan="18"></td>
							</tr>
							<tr>
								<td colspan="6"></td>
								<td class="div_hide" colspan="6">
									<div class="table-foot">
										<ul class="pagination pagination-sm no-margin pull-left">
											<li><a href="javascript:void(0);">当前页：${currentPage}</a></li>
											<li><a onclick="tihuan('right_side1${currentPage-1}')"
												id="shang">&laquo;</a></li>
											<li><a onclick="tihuan('right_side11')" id="one">1</a></li>
											<li><a onclick="tihuan('right_side12')" id="two">2</a></li>
											<c:if test="${findPageStudent.totalPage!=2}">
												<li><a href="javascript:void(0);" id="three">...</a></li>
												<li><a
													onclick="tihuan('right_side1${findPageStudent.totalPage-1}')"
													id="four">${findPageStudent.totalPage-1}</a></li>
												<li><a
													onclick="tihuan('right_side1${findPageStudent.totalPage}')"
													id="five">${findPageStudent.totalPage}</a></li>
											</c:if>
											<li><a onclick="tihuan('right_side1${currentPage+1}')"
												id="xia">&raquo;</a></li>
											<li><a href="javascript:void(0)">总页数：${findPageStudent.totalPage}</a></li>
										</ul>
									</div>
								</td>
							</tr>
						</table>
					</form>
				</div>
				<!-- /.box-body -->
			</div>
			<!-- /.box -->
		</div>
	</div>
</section>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">数据更新</h4>
			</div>
			<div class="modal-body">

				<form id="regUser" enctype="multipart/form-data" accept-charset="utf-8">
					<div class="input-group input-group-lg">
						<span class="input-group-addon">&emsp;姓名&emsp;</span> <input
							id="username" class="form-control " type="text" name="username"
							placeholder="请输入姓名" required="required" maxlength="30" />
					</div>
					<br>
					<div class="input-group input-group-lg">
						<span class="input-group-addon">&emsp;学号&emsp;</span> <input
							id="studentid" class="form-control " type="text" name="studentid"
							placeholder="请输入学号" onkeyup="value=value.replace(/[^\d]/g,'')"
							required="required" maxlength="30" />
					</div>
					<br>
					<div class="input-group input-group-lg form_modal">
						<span class="input-group-addon">&emsp;生日&emsp;</span> <input
							type="date" class="form-control" id='datetime' />
					</div>
					<br class="form_modal">
					<div class="input-group input-group-lg form_modal">
						<span class="input-group-addon">&emsp;Q&nbsp;Q&emsp;</span> <input
							id="qq" class="form-control" type="text" placeholder="QQ"
							name="qq" maxlength="15"
							onkeyup="value=value.replace(/[^\d]/g,'')" />
					</div>
					<br class="form_modal">
					<div class="input-group input-group-lg form_modal">
						<span class="input-group-addon">家庭地址</span> <input id="address"
							class="form-control" type="text" placeholder="家庭住址"
							name="address" maxlength="30" />
					</div>
					<br class="form_modal">
					<div class="input-group input-group-lg form_modal">
						<span class="input-group-addon">联系电话</span> <input id="phone"
							class="form-control" type="text" placeholder="联系电话" name="phone"
							maxlength="15" onkeyup="value=value.replace(/[^\d]/g,'')" />
					</div>
					<br class="form_modal">
					<div class="input-group input-group-lg form_modal">
						<span class="input-group-addon">&emsp;头像&emsp;</span> <input
							type="file" class="form-control" name="file" />
					</div>
					<br class="form_modal"> <label
						style="float: left; padding-top: 5px; margin-right: 10px">学院:</label>
					<select class="form-control col-sm-2" style="width: 20%;"
						onmousedown="if(this.options.length>3){this.size=4}"
						onblur="this.size=1" onchange="this.size=1">
						<option></option>
						<option class="divider">xx学院</option>
						<option>yy学院</option>
						<option>yy学院</option>
						<option>yy学院</option>
						<option>yy学院</option>
						<option>yy学院</option>
						<option>yy学院</option>
					</select> <label style="float: left; padding-top: 5px; margin-right: 10px">班级:</label>
					<select class="form-control col-sm-2" style="width: 20%;"
						onmousedown="if(this.options.length>3){this.size=4}"
						onblur="this.size=1" onchange="this.size=1">
						<option></option>
						<option class="divider">xx班级</option>
						<option>yy班级</option>
					</select> <label class="form_modal"
						style="float: left; padding-top: 5px; margin-right: 10px">性别:</label>
					<select class="form-control col-sm-2 form_modal"
						style="width: 20%;">
						<option class="divider">男</option>
						<option>女</option>
					</select><br>
					<!-- /input-group -->
				</form>

			</div>
			<div class="modal-footer">
				<button onclick="update()" type="button" class="btn btn-primary ">提交更改</button>
				<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal -->
</div>